// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
import { contextBridge, ipcRenderer } from 'electron'

contextBridge.exposeInMainWorld("isElectron", true)
contextBridge.exposeInMainWorld("ysElectron", {
    send: (channel:string, data:any) => {
        // whitelist channels
        ipcRenderer.send(channel, data);
        console.log("in send");
    },
    receive: (channel:string, func:any) => {
        ipcRenderer.on(channel, (event, ...args) => func(...args));
         console.log("in recieve");
    },
})
